Page({
  data: {
    phoneNumber: '',
    phoneError: true
  },
  onLoad(options) {
    const { phoneNumber } = options;
    this.setData({
      phoneNumber: phoneNumber,
    });
  },
  onSubmit() {
    const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.data.phoneNumber);
    console.log(isPhoneNumber)

    this.setData({
      phoneError: !isPhoneNumber
    }, () => {
      if (!this.data.phoneError) {
        wx.navigateBack({ backRefresh: true });
      }
      console.log(this.data)
    })
  },
  clearContent() {
    this.setData({
      phoneNumber: '',
    });
  },
});
